/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package th.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author ubuntu
 */
@Entity
@Table(name = "akaun")
@NamedQueries({
    @NamedQuery(name = "Akaun.findAll", query = "SELECT a FROM Akaun a")})
public class Akaun implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_akaun")
    private Integer idAkaun;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "noKp")
    private Pengguna pengguna;
    
    @Basic(optional = false)
    @Column(name = "akaun_tmbhn")
    private String akaunTmbhn;
    
    @Basic(optional = false)
    @Column(name = "no_pengenalan_tmbhn")
    private String noPengenalanTmbhn;
    
    @Column(name = "nama_akaun_tmbhn")
    private String namaAkaunTmbhn;
    
    @Column(name = "akaun_utama")
    private String akaunUtama;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "kod_akaun")
    private KodAkaun jenisAkaun;
    
    
    @Embedded
    private InfoAudit infoAudit;


    public Akaun() {
    }

    public Akaun(Integer idAkaun) {
        this.idAkaun = idAkaun;
    }

    public Integer getIdAkaun() {
        return idAkaun;
    }

    public void setIdAkaun(Integer idAkaun) {
        this.idAkaun = idAkaun;
    }

    public Pengguna getPengguna() {
        return pengguna;
    }

    public void setPengguna(Pengguna pengguna) {
        this.pengguna = pengguna;
    }

    public String getAkaunTmbhn() {
        return akaunTmbhn;
    }

    public void setAkaunTmbhn(String akaunTmbhn) {
        this.akaunTmbhn = akaunTmbhn;
    }

    public String getNoPengenalanTmbhn() {
        return noPengenalanTmbhn;
    }

    public void setNoPengenalanTmbhn(String noPengenalanTmbhn) {
        this.noPengenalanTmbhn = noPengenalanTmbhn;
    }

    public String getNamaAkaunTmbhn() {
        return namaAkaunTmbhn;
    }

    public void setNamaAkaunTmbhn(String namaAkaunTmbhn) {
        this.namaAkaunTmbhn = namaAkaunTmbhn;
    }

    public InfoAudit getInfoAudit() {
        return infoAudit;
    }

    public void setInfoAudit(InfoAudit infoAudit) {
        this.infoAudit = infoAudit;
    }

    public String getAkaunUtama() {
        return akaunUtama;
    }

    public void setAkaunUtama(String akaunUtama) {
        this.akaunUtama = akaunUtama;
    }    

    public KodAkaun getJenisAkaun() {
        return jenisAkaun;
    }

    public void setJenisAkaun(KodAkaun jenisAkaun) {
        this.jenisAkaun = jenisAkaun;
    }
    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAkaun != null ? idAkaun.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Akaun)) {
            return false;
        }
        Akaun other = (Akaun) object;
        if ((this.idAkaun == null && other.idAkaun != null) || (this.idAkaun != null && !this.idAkaun.equals(other.idAkaun))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "th.model.Akaun[ idAkaun=" + idAkaun + " ]";
    }
    
}
